<template>
  <van-nav-bar :title="title" border z-index="101" fixed>
    <template #left>
      <slot name="left">
        <div class="back" v-if="back" @click="gotoback">
          <van-icon name="arrow-left" size="18" color="#ff5f16" />
          <span>返回</span>
        </div>
      </slot>
    </template>
    <!-- <template #right>
      <p>密码登陆</p>
    </template> -->
  </van-nav-bar>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: "",
    },
    back: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {
      showPopover: false,
      actions: [],
    };
  },
  methods: {
    toggleclick(v) {
      this.$router.push({ name: v.name });
    },
    gotoback() {
      this.$router.back();
    },
  },
};
</script>

<style lang="scss" scoped>
.back {
  display: flex;
  align-items: center;
  height: 100%;
  span {
    color: pink;
    line-height: 1;
    margin-top: 1px;
  }
}
</style>